package gui;

import java.util.ArrayList;

import EventHandler.YaimEventHandler;

import protocol.domain.GroupEntry;
import protocol.domain.InstantMessage;
import protocol.generic.Group;
import protocol.self.NewYaimProtocolManager;

public class ClientTest 
{
	public static void main(String args[])throws Exception
	{
		NewYaimProtocolManager manager=new NewYaimProtocolManager("Yaim","dakiler","86264284","211.80.59.116",5223);
//		manager.setName("dakiler");
//		manager.setPassword("86264284");
		manager.setEventHandler(new YaimEventHandler());
		
		manager.connect();
		manager.login();
		Thread.sleep(3000);
		ArrayList<Group>groups=manager.getGroups();
		System.out.println(groups.size());
		for(int i=0;i<groups.size();i++)
		{
			Group group=groups.get(i);
			System.out.println(group.getName());
			ArrayList<GroupEntry> entries=group.getGroupEntries();
			for(int j=0;j<entries.size();j++)
			{
				GroupEntry entry=entries.get(j);
				System.out.println(entry.getAlias());
			}
		}/**/
		manager.sendMessage(new InstantMessage("dakiler","aa","hello"));
	}
}
